package com.zhao.redis;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;

import java.util.List;

//jedis操作键相关的指令
public class TestString {

    private Jedis jedis;

    @Before
    public void before() {
        jedis = new Jedis("192.168.200.120", 6379);
    }

    @After
    public void after() {
        jedis.close();
    }

    @Test
    public void testSet() {
        jedis.set("name", "xiaocheng");
    }

    @Test
    public void testGet() {
        String name = jedis.get("name");
        System.out.println(name);
    }

    @Test
    public void testMSet() {
        jedis.mset("age", "18", "bir", "2012-12-12");
    }

    @Test
    public void testMGet() {
        List<String> infos = jedis.mget("age", "bir");

        infos.forEach(info -> System.out.println(info));
    }

    //剩下的命令练习时书写

}
